Sensor Fusion for Kinetis MCUs (ISSDK/KSDK version)
DecodeCommandBytes.c File Reference
+ Include dependency graph for DecodeCommandBytes.c:

Go to the source code of this file.

Macros

#define cmd_VGplus   (((((('V' << 8) | 'G') << 8) | '+') << 8) | ' ')
 
#define cmd_VGminus   (((((('V' << 8) | 'G') << 8) | '-') << 8) | ' ')
 
#define cmd_DBplus   (((((('D' << 8) | 'B') << 8) | '+') << 8) | ' ')
 
#define cmd_DBminus   (((((('D' << 8) | 'B') << 8) | '-') << 8) | ' ')
 
#define cmd_Q3   (((((('Q' << 8) | '3') << 8) | ' ') << 8) | ' ')
 
#define cmd_Q3M   (((((('Q' << 8) | '3') << 8) | 'M') << 8) | ' ')
 
#define cmd_Q3G   (((((('Q' << 8) | '3') << 8) | 'G') << 8) | ' ')
 
#define cmd_Q6MA   (((((('Q' << 8) | '6') << 8) | 'M') << 8) | 'A')
 
#define cmd_Q6AG   (((((('Q' << 8) | '6') << 8) | 'A') << 8) | 'G')
 
#define cmd_Q9   (((((('Q' << 8) | '9') << 8) | ' ') << 8) | ' ')
 
#define cmd_RPCplus   (((((('R' << 8) | 'P') << 8) | 'C') << 8) | '+')
 
#define cmd_RPCminus   (((((('R' << 8) | 'P') << 8) | 'C') << 8) | '-')
 
#define cmd_ALTplus   (((((('A' << 8) | 'L') << 8) | 'T') << 8) | '+')
 
#define cmd_ALTminus   (((((('A' << 8) | 'L') << 8) | 'T') << 8) | '-')
 
#define cmd_RST   (((((('R' << 8) | 'S') << 8) | 'T') << 8) | ' ')
 
#define cmd_RINS   (((((('R' << 8) | 'I') << 8) | 'N') << 8) | 'S')
 
#define cmd_SVAC   (((((('S' << 8) | 'V') << 8) | 'A') << 8) | 'C')
 
#define cmd_SVMC   (((((('S' << 8) | 'V') << 8) | 'M') << 8) | 'C')
 
#define cmd_SVYC   (((((('S' << 8) | 'V') << 8) | 'Y') << 8) | 'C')
 
#define cmd_SVGC   (((((('S' << 8) | 'V') << 8) | 'G') << 8) | 'C')
 
#define cmd_ERAC   (((((('E' << 8) | 'R') << 8) | 'A') << 8) | 'C')
 
#define cmd_ERMC   (((((('E' << 8) | 'R') << 8) | 'M') << 8) | 'C')
 
#define cmd_ERYC   (((((('E' << 8) | 'R') << 8) | 'Y') << 8) | 'C')
 
#define cmd_ERGC   (((((('E' << 8) | 'R') << 8) | 'G') << 8) | 'C')
 
#define cmd_180X   (((((('1' << 8) | '8') << 8) | '0') << 8) | 'X')
 
#define cmd_180Y   (((((('1' << 8) | '8') << 8) | '0') << 8) | 'Y')
 
#define cmd_180Z   (((((('1' << 8) | '8') << 8) | '0') << 8) | 'Z')
 
#define cmd_M90X   (((((('M' << 8) | '9') << 8) | '0') << 8) | 'X')
 
#define cmd_P90X   (((((('P' << 8) | '9') << 8) | '0') << 8) | 'X')
 
#define cmd_M90Y   (((((('M' << 8) | '9') << 8) | '0') << 8) | 'Y')
 
#define cmd_P90Y   (((((('P' << 8) | '9') << 8) | '0') << 8) | 'Y')
 
#define cmd_M90Z   (((((('M' << 8) | '9') << 8) | '0') << 8) | 'Z')
 
#define cmd_P90Z   (((((('P' << 8) | '9') << 8) | '0') << 8) | 'Z')
 
#define cmd_PA00   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '0')
 
#define cmd_PA01   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '1')
 
#define cmd_PA02   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '2')
 
#define cmd_PA03   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '3')
 
#define cmd_PA04   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '4')
 
#define cmd_PA05   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '5')
 
#define cmd_PA06   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '6')
 
#define cmd_PA07   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '7')
 
#define cmd_PA08   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '8')
 
#define cmd_PA09   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '9')
 
#define cmd_PA10   (((((('P' << 8) | 'A') << 8) | '1') << 8) | '0')
 
#define cmd_PA11   (((((('P' << 8) | 'A') << 8) | '1') << 8) | '1')
 

Functions

void DecodeCommandBytes (SensorFusionGlobals *sfg, char iCommandBuffer[], uint8 sUART_InputBuffer[], uint16 nbytes)
 

Macro Definition Documentation

#define cmd_180X   (((((('1' << 8) | '8') << 8) | '0') << 8) | 'X')

Definition at line 68 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_180Y   (((((('1' << 8) | '8') << 8) | '0') << 8) | 'Y')

Definition at line 69 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_180Z   (((((('1' << 8) | '8') << 8) | '0') << 8) | 'Z')

Definition at line 70 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_ALTminus   (((((('A' << 8) | 'L') << 8) | 'T') << 8) | '-')

Definition at line 57 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_ALTplus   (((((('A' << 8) | 'L') << 8) | 'T') << 8) | '+')

Definition at line 56 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_DBminus   (((((('D' << 8) | 'B') << 8) | '-') << 8) | ' ')

Definition at line 47 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_DBplus   (((((('D' << 8) | 'B') << 8) | '+') << 8) | ' ')

Definition at line 46 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_ERAC   (((((('E' << 8) | 'R') << 8) | 'A') << 8) | 'C')

Definition at line 64 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_ERGC   (((((('E' << 8) | 'R') << 8) | 'G') << 8) | 'C')

Definition at line 67 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_ERMC   (((((('E' << 8) | 'R') << 8) | 'M') << 8) | 'C')

Definition at line 65 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_ERYC   (((((('E' << 8) | 'R') << 8) | 'Y') << 8) | 'C')

Definition at line 66 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_M90X   (((((('M' << 8) | '9') << 8) | '0') << 8) | 'X')

Definition at line 71 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_M90Y   (((((('M' << 8) | '9') << 8) | '0') << 8) | 'Y')

Definition at line 73 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_M90Z   (((((('M' << 8) | '9') << 8) | '0') << 8) | 'Z')

Definition at line 75 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_P90X   (((((('P' << 8) | '9') << 8) | '0') << 8) | 'X')

Definition at line 72 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_P90Y   (((((('P' << 8) | '9') << 8) | '0') << 8) | 'Y')

Definition at line 74 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_P90Z   (((((('P' << 8) | '9') << 8) | '0') << 8) | 'Z')

Definition at line 76 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA00   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '0')

Definition at line 77 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA01   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '1')

Definition at line 78 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA02   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '2')

Definition at line 79 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA03   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '3')

Definition at line 80 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA04   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '4')

Definition at line 81 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA05   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '5')

Definition at line 82 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA06   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '6')

Definition at line 83 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA07   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '7')

Definition at line 84 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA08   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '8')

Definition at line 85 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA09   (((((('P' << 8) | 'A') << 8) | '0') << 8) | '9')

Definition at line 86 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA10   (((((('P' << 8) | 'A') << 8) | '1') << 8) | '0')

Definition at line 87 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_PA11   (((((('P' << 8) | 'A') << 8) | '1') << 8) | '1')

Definition at line 88 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_Q3   (((((('Q' << 8) | '3') << 8) | ' ') << 8) | ' ')

Definition at line 48 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_Q3G   (((((('Q' << 8) | '3') << 8) | 'G') << 8) | ' ')

Definition at line 50 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_Q3M   (((((('Q' << 8) | '3') << 8) | 'M') << 8) | ' ')

Definition at line 49 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_Q6AG   (((((('Q' << 8) | '6') << 8) | 'A') << 8) | 'G')

Definition at line 52 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_Q6MA   (((((('Q' << 8) | '6') << 8) | 'M') << 8) | 'A')

Definition at line 51 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_Q9   (((((('Q' << 8) | '9') << 8) | ' ') << 8) | ' ')

Definition at line 53 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_RINS   (((((('R' << 8) | 'I') << 8) | 'N') << 8) | 'S')

Definition at line 59 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_RPCminus   (((((('R' << 8) | 'P') << 8) | 'C') << 8) | '-')

Definition at line 55 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_RPCplus   (((((('R' << 8) | 'P') << 8) | 'C') << 8) | '+')

Definition at line 54 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_RST   (((((('R' << 8) | 'S') << 8) | 'T') << 8) | ' ')

Definition at line 58 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_SVAC   (((((('S' << 8) | 'V') << 8) | 'A') << 8) | 'C')

Definition at line 60 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_SVGC   (((((('S' << 8) | 'V') << 8) | 'G') << 8) | 'C')

Definition at line 63 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_SVMC   (((((('S' << 8) | 'V') << 8) | 'M') << 8) | 'C')

Definition at line 61 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_SVYC   (((((('S' << 8) | 'V') << 8) | 'Y') << 8) | 'C')

Definition at line 62 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_VGminus   (((((('V' << 8) | 'G') << 8) | '-') << 8) | ' ')

Definition at line 45 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

#define cmd_VGplus   (((((('V' << 8) | 'G') << 8) | '+') << 8) | ' ')

Definition at line 44 of file DecodeCommandBytes.c.

Referenced by DecodeCommandBytes().

Function Documentation

void DecodeCommandBytes ( SensorFusionGlobals sfg,
char  iCommandBuffer[],
uint8  sUART_InputBuffer[],
uint16  nbytes 
)

This function is responsible for decoding commands sent by the NXP Sensor Fusion Toolbox and setting the appropriate flags in the ControlSubsystem data structure. Packet protocols are defined in the NXP Sensor Fusion for Kinetis Product Development Kit User Guide.

Definition at line 90 of file DecodeCommandBytes.c.

Referenced by WIRED_UART_IRQHandler(), and WIRELESS_UART_IRQHandler().

91 {
92  int32 isum; // 32 bit command identifier
93  int16 i, j; // loop counters
94 
95  // parse all received bytes in sUARTInputBuf into the iCommandBuffer delay line
96  for (i = 0; i < nbytes; i++) {
97  // shuffle the iCommandBuffer delay line and add the new command byte
98  for (j = 0; j < 3; j++)
99  iCommandBuffer[j] = iCommandBuffer[j + 1];
100  iCommandBuffer[3] = sUART_InputBuffer[i];
101 
102  // check if we have a valid command yet
103  isum = ((((((int32)iCommandBuffer[0] << 8) | iCommandBuffer[1]) << 8) | iCommandBuffer[2]) << 8) | iCommandBuffer[3];
104  switch (isum) {
105  case cmd_VGplus: // "VG+ " = enable angular velocity packet transmission
107  iCommandBuffer[3] = '~';
108  break;
109 
110  case cmd_VGminus: // "VG- " = disable angular velocity packet transmission
112  iCommandBuffer[3] = '~';
113  break;
114 
115  case cmd_DBplus: // "DB+ " = enable debug packet transmission
116  sfg->pControlSubsystem->DebugPacketOn = true;
117  iCommandBuffer[3] = '~';
118  break;
119 
120  case cmd_DBminus: // "DB- " = disable debug packet transmission
121  sfg->pControlSubsystem->DebugPacketOn = false;
122  iCommandBuffer[3] = '~';
123  break;
124 
125  case cmd_Q3: // "Q3 " = transmit 3-axis accelerometer quaternion in standard packet
126 #if F_3DOF_G_BASIC
128 #endif
129  iCommandBuffer[3] = '~';
130  break;
131 
132  case cmd_Q3M: // "Q3M " = transmit 3-axis magnetometer quaternion in standard packet
133 #if F_3DOF_B_BASIC
135 #endif
136  iCommandBuffer[3] = '~';
137  break;
138 
139  case cmd_Q3G: // "Q3G " = transmit 3-axis gyro quaternion in standard packet
140 #if F_3DOF_Y_BASIC
142 #endif
143  iCommandBuffer[3] = '~';
144  break;
145 
146  case cmd_Q6MA: // "Q6MA" = transmit 6-axis mag/accel quaternion in standard packet
147 #if F_6DOF_GB_BASIC
149 #endif
150  iCommandBuffer[3] = '~';
151  break;
152 
153  case cmd_Q6AG: // "Q6AG" = transmit 6-axis accel/gyro quaternion in standard packet
154 #if F_6DOF_GY_KALMAN
156 #endif
157  iCommandBuffer[3] = '~';
158  break;
159 
160  case cmd_Q9: // "Q9 " = transmit 9-axis quaternion in standard packet (default)
161 #if F_9DOF_GBY_KALMAN
163 #endif
164  iCommandBuffer[3] = '~';
165  break;
166 
167  case cmd_RPCplus: // "RPC+" = Roll/Pitch/Compass on
168  sfg->pControlSubsystem->RPCPacketOn = true;
169  iCommandBuffer[3] = '~';
170  break;
171 
172  case cmd_RPCminus: // "RPC-" = Roll/Pitch/Compass off
173  sfg->pControlSubsystem->RPCPacketOn = false;
174  iCommandBuffer[3] = '~';
175  break;
176 
177  case cmd_ALTplus: // "ALT+" = Altitude packet on
178  sfg->pControlSubsystem->AltPacketOn = true;
179  iCommandBuffer[3] = '~';
180  break;
181 
182  case cmd_ALTminus: // "ALT-" = Altitude packet off
183  sfg->pControlSubsystem->AltPacketOn = false;
184  iCommandBuffer[3] = '~';
185  break;
186 
187  case cmd_RST: // "RST " = Soft reset
188  // reset sensor fusion
189  fInitializeFusion(sfg);
190 
191  // reset magnetic calibration and magnetometer data buffer
192 #if F_USING_MAG
194 #endif
195  // reset precision accelerometer calibration and accelerometer measurements
196 #if F_USING_ACCEL
197  fInitializeAccelCalibration(&sfg->AccelCal, &sfg->AccelBuffer, &(sfg->pControlSubsystem->AccelCalPacketOn)) ;
198 #endif
199  iCommandBuffer[3] = '~';
200  break;
201 
202  case cmd_RINS: // "RINS" = Reset INS inertial navigation velocity and position
203 #if F_9DOF_GBY_KALMAN
204  for (i = CHX; i <= CHZ; i++) {
205  sfg->SV_9DOF_GBY_KALMAN.fVelGl[i] = 0.0F;
206  sfg->SV_9DOF_GBY_KALMAN.fDisGl[i] = 0.0F;
207  }
208 #endif
209  iCommandBuffer[3] = '~';
210  break;
211 
212  case cmd_SVAC: // "SVAC" = save all calibrations to Kinetis flash
216  iCommandBuffer[3] = '~';
217  break;
218 
219  case cmd_SVMC: // "SVMC" = save magnetic calibration to Kinetis flash
221  iCommandBuffer[3] = '~';
222  break;
223 
224  case cmd_SVYC: // "SVYC" = save gyroscope calibration to Kinetis flash
226  iCommandBuffer[3] = '~';
227  break;
228 
229  case cmd_SVGC: // "SVGC" = save precision accelerometer calibration to Kinetis flash
231  iCommandBuffer[3] = '~';
232  break;
233 
234  case cmd_ERAC: // "ERAC" = erase all calibrations from Kinetis flash
238  iCommandBuffer[3] = '~';
239  break;
240 
241  case cmd_ERMC: // "ERMC" = erase magnetic calibration offset 0 bytes from Kinetis flash
243  iCommandBuffer[3] = '~';
244  break;
245 
246  case cmd_ERYC: // "ERYC" = erase gyro offset calibrationoffset 128 bytes from Kinetis flash
248  iCommandBuffer[3] = '~';
249  break;
250 
251  case cmd_ERGC: // "ERGC" = erase precision accelerometer calibration offset 192 bytesfrom Kinetis flash
253  iCommandBuffer[3] = '~';
254  break;
255 
256  case cmd_180X: // "180X" perturbation
257  sfg->iPerturbation = 1;
258  iCommandBuffer[3] = '~';
259  break;
260 
261  case cmd_180Y: // "180Y" perturbation
262  sfg->iPerturbation = 2;
263  iCommandBuffer[3] = '~';
264  break;
265 
266  case cmd_180Z: // "180Z" perturbation
267  sfg->iPerturbation = 3;
268  iCommandBuffer[3] = '~';
269  break;
270 
271  case cmd_M90X: // "M90X" perturbation
272  sfg->iPerturbation = 4;
273  iCommandBuffer[3] = '~';
274  break;
275 
276  case cmd_P90X: // "P90X" perturbation
277  sfg->iPerturbation = 5;
278  iCommandBuffer[3] = '~';
279  break;
280 
281  case cmd_M90Y: // "M90Y" perturbation
282  sfg->iPerturbation = 6;
283  iCommandBuffer[3] = '~';
284  break;
285 
286  case cmd_P90Y: // "P90Y" perturbation
287  sfg->iPerturbation = 7;
288  iCommandBuffer[3] = '~';
289  break;
290 
291  case cmd_M90Z: // "M90Z" perturbation
292  sfg->iPerturbation = 8;
293  iCommandBuffer[3] = '~';
294  break;
295 
296  case cmd_P90Z: // "P90Z" perturbation
297  sfg->iPerturbation = 9;
298  iCommandBuffer[3] = '~';
299  break;
300 
301 #if F_USING_ACCEL
302  case cmd_PA00: // "PA00" average precision accelerometer location 0
303  sfg->AccelBuffer.iStoreLocation = 0;
304  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
305  iCommandBuffer[3] = '~';
306  break;
307 
308  case cmd_PA01: // "PA01" average precision accelerometer location 1
309  sfg->AccelBuffer.iStoreLocation = 1;
310  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
311  iCommandBuffer[3] = '~';
312  break;
313 
314  case cmd_PA02: // "PA02" average precision accelerometer location 2
315  sfg->AccelBuffer.iStoreLocation = 2;
316  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
317  iCommandBuffer[3] = '~';
318  break;
319 
320  case cmd_PA03: // "PA03" average precision accelerometer location 3
321  sfg->AccelBuffer.iStoreLocation = 3;
322  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
323  iCommandBuffer[3] = '~';
324  break;
325 
326  case cmd_PA04: // "PA04" average precision accelerometer location 4
327  sfg->AccelBuffer.iStoreLocation = 4;
328  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
329  iCommandBuffer[3] = '~';
330  break;
331 
332  case cmd_PA05: // "PA05" average precision accelerometer location 5
333  sfg->AccelBuffer.iStoreLocation = 5;
334  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
335  iCommandBuffer[3] = '~';
336  break;
337 
338  case cmd_PA06: // "PA06" average precision accelerometer location 6
339  sfg->AccelBuffer.iStoreLocation = 6;
340  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
341  iCommandBuffer[3] = '~';
342  break;
343 
344  case cmd_PA07: // "PA07" average precision accelerometer location 7
345  sfg->AccelBuffer.iStoreLocation = 7;
346  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
347  iCommandBuffer[3] = '~';
348  break;
349 
350  case cmd_PA08: // "PA08" average precision accelerometer location 8
351  sfg->AccelBuffer.iStoreLocation = 8;
352  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
353  iCommandBuffer[3] = '~';
354  break;
355 
356  case cmd_PA09: // "PA09" average precision accelerometer location 9
357  sfg->AccelBuffer.iStoreLocation = 9;
358  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
359  iCommandBuffer[3] = '~';
360  break;
361 
362  case cmd_PA10: // "PA10" average precision accelerometer location 10
363  sfg->AccelBuffer.iStoreLocation = 10;
364  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
365  iCommandBuffer[3] = '~';
366  break;
367 
368  case cmd_PA11: // "PA11" average precision accelerometer location 11
369  sfg->AccelBuffer.iStoreLocation = 11;
370  sfg->AccelBuffer.iStoreCounter = (ACCEL_CAL_AVERAGING_SECS * FUSION_HZ);
371  iCommandBuffer[3] = '~';
372  break;
373 #endif // precision accelerometer calibration
374 
375  default:
376  // no action
377  break;
378  }
379  } // end of loop over received characters
380 
381  return;
382 }
#define cmd_PA04
Quaternion derived from full 9-axis sensor fusion.
Definition: sensor_fusion.h:70
void EraseGyroCalibrationFromNVM(void)
void fInitializeFusion(SensorFusionGlobals *sfg)
Definition: fusion.c:51
#define cmd_SVGC
void SaveMagCalibrationToNVM(SensorFusionGlobals *sfg)
#define cmd_SVYC
void fInitializeMagCalibration(MagCalibration *pthisMagCal, MagBuffer *pthisMagBuffer)
Definition: magnetic.c:41
#define cmd_M90Y
#define cmd_PA08
void SaveAccelCalibrationToNVM(SensorFusionGlobals *sfg)
void EraseMagCalibrationFromNVM(void)
volatile uint8_t AltPacketOn
flag to enable altitude packet
Definition: control.h:70
#define cmd_P90Y
Quaternion derived from 3-axis mag only (auto compass algorithm)
Definition: sensor_fusion.h:66
#define cmd_RST
MagCalibration MagCal
mag cal storage
#define cmd_ERGC
#define cmd_VGminus
volatile int8_t AccelCalPacketOn
variable used to coordinate accelerometer calibration
Definition: control.h:71
#define cmd_SVAC
#define cmd_PA10
Quaternion derived from 3-axis gyro only (rotation)
Definition: sensor_fusion.h:67
Quaternion derived from 3-axis accel + 3 axis mag (eCompass)
Definition: sensor_fusion.h:68
int32_t int32
Definition: sensor_fusion.h:57
Quaternion derived from 3-axis accel + 3-axis gyro (gaming)
Definition: sensor_fusion.h:69
#define cmd_DBminus
struct ControlSubsystem * pControlSubsystem
void SaveGyroCalibrationToNVM(SensorFusionGlobals *sfg)
#define cmd_PA05
#define cmd_PA01
#define cmd_P90X
#define cmd_PA00
#define CHZ
#define cmd_DBplus
#define cmd_PA06
#define cmd_PA03
volatile uint8_t DebugPacketOn
flag to enable debug packet
Definition: control.h:68
#define cmd_RPCminus
#define cmd_PA07
#define CHX
Used to access X-channel entries in various data data structures.
Definition: sensor_fusion.h:76
#define cmd_Q3M
#define cmd_P90Z
MagBuffer MagBuffer
mag cal constellation points
#define cmd_SVMC
#define cmd_180Y
#define cmd_ALTplus
#define cmd_PA11
#define cmd_Q3
#define cmd_ALTminus
volatile uint8_t RPCPacketOn
flag to enable roll, pitch, compass packet
Definition: control.h:69
Quaternion derived from 3-axis accel (tilt)
Definition: sensor_fusion.h:65
void EraseAccelCalibrationFromNVM(void)
#define FUSION_HZ
(int) actual rate of fusion algorithm execution and sensor FIFO reads
#define cmd_Q6AG
#define cmd_Q6MA
#define cmd_RPCplus
#define cmd_RINS
#define cmd_ERMC
#define cmd_VGplus
void fInitializeAccelCalibration(struct AccelCalibration *pthisAccelCal, struct AccelBuffer *pthisAccelBuffer, volatile int8 *AccelCalPacketOn)
Initialize the accelerometer calibration functions.
#define cmd_PA02
int16_t int16
Definition: sensor_fusion.h:56
#define cmd_PA09
#define cmd_180X
#define cmd_ERAC
#define ACCEL_CAL_AVERAGING_SECS
calibration constants
#define cmd_180Z
#define cmd_M90X
volatile uint8_t iPerturbation
test perturbation to be applied
volatile quaternion_type QuaternionPacketType
quaternion type transmitted over UART
Definition: control.h:66
#define cmd_M90Z
#define cmd_Q3G
#define cmd_Q9
volatile uint8_t AngularVelocityPacketOn
flag to enable angular velocity packet
Definition: control.h:67
#define cmd_ERYC

+ Here is the call graph for this function:

+ Here is the caller graph for this function: